﻿@{
    ViewBag.Title = "CourseList";
    Layout = "~/Views/Shared/_BasicLayout.cshtml";
}
<script type="text/javascript">
    $(function () {
        var rowData;
        var height = $("#divTotal").height();
        var master = $("#master").height();
        var content = parseFloat(height) - parseFloat(master) - 30;
        $("#tbList").css("height", content);
    });
</script>
<script type="text/javascript">
    $(function () {
        $("#tbList").datagrid({
            url: '/BD/CourseBD/getCourseInfoList',
            loadMsg: '数据加载中请稍后……',
            pagination: true,
            rownumbers: true,
            idField: "ID",
            lines: true,
            singleSelect: true,
            pageSize: 20,
            queryParams: com.serializeSearchArray("form1"),
            pageList: [20, 50, 100],
            striped: true,
            columns: [[
                {
                    field: 'ck', checkbox: true, width: 30
                },
                {
                    field: 'CourseType', title: '科目名称', sortable: true, width: 80, align: "center"
                },
                {
                    field: 'Name', title: '课程名称', sortable: true, width: 80, align: "center"
                },
                {
                    field: 'Year', title: '学年', sortable: true, width: 80, align: "center"
                },
                {
                    field: 'Term', title: '学期', sortable: true, width: 80, align: "center", formatter: function (value, row, index) {
                        return com.getArrayText(StaticCombo.Term, value);
                    }
                },
                {
                    field: 'GradeType', title: '年级', sortable: true, width: 80, align: "center"
                },
                {
                    field: 'Book', title: '教材', sortable: true, width: 80, align: "center"
                },
                {
                    field: 'AccountForm', title: '计算方式', sortable: true, width: 80, align: "center", formatter: function (value, row, index) {
                        return com.getArrayText(StaticCombo.AccountForm, value);
                    }
                },
                {
                    field: 'Number', title: '课时', sortable: true, width: 80, align: "center"
                },
                {
                    field: 'AddName', title: '维护人', sortable: true, width: 80, align: "center"
                },
                {
                    field: 'AddTime', title: '填写日期', sortable: true, width: 150, align: "center"
                },
                {
                    field: 'Note', title: '备注', sortable: true, width: 200, align: "center"
                }
            ]],
        });
    })
</script>
<script type="text/javascript">
    function funcSearch() {
        var para = com.serializeSearchArray("form1");
        $("#tbList").datagrid("load", para);
    }
    function funcAdd() {
        top.wrapper.addTab("添加课程", "/BD/CourseBD/CourseDetail?action=add");
    }
    function funcEdit() {
        var rowData = $("#tbList").datagrid("getSelected");
        if (rowData) {
            top.wrapper.addTab("修改课程", "/BD/CourseBD/CourseDetail?action=edit&id=" + rowData.ID);
        }
        else {
            com.message("information", "请选中一行数据");
        }
    }
    function funcRemove() {
        $.messager.confirm('确认对话框', '您确定删除该课程吗？', function (r) {
            if (r) {
                var rowData = $("#tbList").datagrid("getSelected");
                if (rowData) {
                    com.ajax({
                        url: '/BD/CourseBD/DeleteCourse',
                        data: { Id: rowData.ID },
                        success: function (data) {
                            com.message(data.state, data.msg, function () { $("#tbList").datagrid("reload"); })
                        }
                    });
                }
            }
        });
    }
    function funcReload() {
        $("#form1").form("reset");
        var para = com.serializeSearchArray("form1");
        $("#tbList").datagrid("load", para);
    }
</script>
<div id="divTotal" style="height: 100%; width: 100%">
    <div style="margin:5px" id="master">
        <form id="form1">
            <input id="Name" name="Name" class="easyui-textbox" data-options="prompt:'课程名称'" data-cp="co">
            <input id="AddTime" name="AddTime" class="easyui-datebox" data-options="prompt:'添加日期'" data-cp="co">
        </form>
    </div>
    <table id="tbList" title="课程列表" style="width: 100%"></table>
</div>
